import request from '@/config/axios'

// 用户心理测评记录 VO
export interface UserPsychAssessmentRecordVO {
  id: number // 主键
  title: string // 标题
  riskLevel: string // 风险等级（字典表：business_psych_question_risk_level）
  done: boolean // 是否完成（0否 1是）
}

// 用户心理测评记录 API
export const UserPsychAssessmentRecordApi = {
  // 查询用户心理测评记录分页
  getUserPsychAssessmentRecordPage: async (params: any) => {
    return await request.get({ url: `/business/user-psych-assessment-record/page`, params })
  },

  // 查询用户心理测评记录详情
  getUserPsychAssessmentRecord: async (id: number) => {
    return await request.get({ url: `/business/user-psych-assessment-record/get?id=` + id })
  },

  // 新增用户心理测评记录
  createUserPsychAssessmentRecord: async (data: UserPsychAssessmentRecordVO) => {
    return await request.post({ url: `/business/user-psych-assessment-record/create`, data })
  },

  // 修改用户心理测评记录
  updateUserPsychAssessmentRecord: async (data: UserPsychAssessmentRecordVO) => {
    return await request.put({ url: `/business/user-psych-assessment-record/update`, data })
  },

  // 删除用户心理测评记录
  deleteUserPsychAssessmentRecord: async (id: number) => {
    return await request.delete({ url: `/business/user-psych-assessment-record/delete?id=` + id })
  },

  // 导出用户心理测评记录 Excel
  exportUserPsychAssessmentRecord: async (params) => {
    return await request.download({ url: `/business/user-psych-assessment-record/export-excel`, params })
  },

// ==================== 子表（用户心理测评题目表） ====================

  // 获得用户心理测评题目表分页
  getUserPsychQuestionRecordPage: async (params) => {
    return await request.get({ url: `/business/user-psych-assessment-record/user-psych-question-record/page`, params })
  },
  // 新增用户心理测评题目表
  createUserPsychQuestionRecord: async (data) => {
    return await request.post({ url: `/business/user-psych-assessment-record/user-psych-question-record/create`, data })
  },

  // 修改用户心理测评题目表
  updateUserPsychQuestionRecord: async (data) => {
    return await request.put({ url: `/business/user-psych-assessment-record/user-psych-question-record/update`, data })
  },

  // 删除用户心理测评题目表
  deleteUserPsychQuestionRecord: async (id: number) => {
    return await request.delete({ url: `/business/user-psych-assessment-record/user-psych-question-record/delete?id=` + id })
  },

  // 获得用户心理测评题目表
  getUserPsychQuestionRecord: async (id: number) => {
    return await request.get({ url: `/business/user-psych-assessment-record/user-psych-question-record/get?id=` + id })
  },
}